const Router=require('koa-router')
const {auth}=require('../middleWare/auth.middleware')
const { validator}=require('../middleWare/goods.middleware')
const router=new Router({prefix:'/goods'})
const {uploadImage,createGoods,update,remove,offStore,findAll,findOne,findMySend,findSomeAll,findListGoods,mySaleOut,searchGoodsList}=require('../controller/goods.controller')
//上传图片的接口
router.post('/uploadImage',auth,uploadImage)
//列表性质的获取商品信息
router.get('/getGoodsList',findListGoods)
//发布商品的接口
router.post('/',auth,validator,createGoods)
//修改商品
router.put('/:id',auth,validator,update)
//硬删除商品
router.delete('/:id',auth,remove)
//上架下架商品
router.put('/change/:id',auth,offStore)
//获取自己发布的商品
router.get('/mySend',auth,findMySend)
//获取商品列表
router.get('/',findAll)
//获取特定商品列表
router.get('/some',findSomeAll)
//获取商品信息
router.get('/oneInfo',findOne)
//我的卖出
router.get('/getMySaleOut',auth,mySaleOut)
//搜索商品
router.get('/getSearchList',searchGoodsList)
module.exports=router